libxl: Initialise CTX->xce in domain suspend, as needed
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 5 Jan 2015 14:31:00 +0000 (14:31 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Mon, 5 Jan 2015 16:42:11 +0000 (16:42 +0000)
commit6b511af68618a86d5a2258e649042a3f0b8ace52
tree6e03a271c4b5db7d4f5c2c917b2db0e194a9a61f
parent4d9ba7b2188083a09d1b1a1bda7054cc3eb77f67
libxl: Initialise CTX->xce in domain suspend, as needed

When excuting xl migrate/Remus, the following error can occur:
  [root@master xen]# xl migrate 5 slaver
  migration target: Ready to receive domain.
  Saving to migration stream new xl format (info 0x1/0x0/1225)
  Loading new save file <incoming migration stream> (new xl fmt info 0x1/0x0/12\
)
   Savefile contains xl domain config in JSON format
  Parsing config from <saved>
  Segmentation fault (core dumped)

This is because CTX->xce is used without been initialized.
The bug was introduced by commit 2ffeb5d7f5d8
    libxl: events: Deregister evtchn fd when not needed
which removed the initialization of xce from libxl__ctx_alloc.

In this patch we initialise the CTX->xce before using it.  Also, we
adjust the doc comment for libxl__ev_evtchn_* to mention the need to
do so.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Wei Liu <wei.liu2@citrix.com>
tools/libxl/libxl_dom.c
tools/libxl/libxl_internal.h